﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using Telerik.Web.UI;
using System.IO;
using KPIS.GERP.GFMS.IBLL;
using KPIS.GERP.GFMS.BLL;
using KPIS.GERP.GFMS.DAL;
using KPIS.GERP.GFMS.MODEL;

using KPIS.GERP.GFMS.APP.App_UI.Commons;

namespace KPIS.GERP.GFMS.APP.App_UI.Forms
{
    public partial class UpdateReceipt : System.Web.UI.Page
    {
        Main main = new Main();
        IBLL_FIM_Payments pay = new B_FIM_Payments();

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                dpRealPayDate.SetValue(DateTime.Today);
            }
        }

        protected void cmdOK_Click(object sender, EventArgs e)
        {
            M_FIM_Payments info = new M_FIM_Payments();
            string strUserID = Session["EmpSeq"].ToString();
            DateTime dtNow = DateTime.Now;
            string strPaySeq = Session["PaySeq"].ToString();
            string strReceiptNo = txtReceiptNo.Text;
            string strReceiptName = txtReceiptName.Text;
            string strRealPayDate = dpRealPayDate.GetStringValue();
            info.pay_seq = Convert.ToInt32(strPaySeq);
            info.receipt_no = strReceiptNo;
            info.receipt_name = strReceiptName;
            info.real_pay_date = main.ConvertNullDateTime(strRealPayDate);
            info.updated_by = main.ConvertNullInt(strUserID);
            info.updated_when = main.ConvertNullDateTime(dtNow);

            pay.UpdateReceipt(info);
            //ClosePopup();
        }

        protected void ClosePopup()
        {
            ScriptManager.RegisterClientScriptBlock(
                this.Page,
                this.GetType(),
                "WebUserControlSript",
                "returnToParent()",
                true);
        }
    }
}
